package com.example.team.controller;

import com.example.team.entity.Property;
import com.example.team.service.IPropertyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 编写者：沈超
 * 时间：2023/10/31
 */
@RestController
@Api
public class PropertyController {
    @Autowired
    private IPropertyService propertyServic;
    @RequestMapping("/Property")
    public String Property(){
        return "物业信息管理系统";
    }
    @ApiOperation(value = "添加物业信息")
    @RequestMapping("addProperty")
    public int insertProperty(Property property){
        return propertyServic.insertProperty(property);
    }
    @ApiOperation(value = "删除物业信息")
    @RequestMapping("/deletPropertye")
    public int delectProperty(String PropertyId){
        Property property=new Property();
        property.setPropertyId(PropertyId);
        return propertyServic.deleteProperty(property);
    }
    @ApiOperation(value = "修改物业信息",
            notes = "成功返回1")
    @RequestMapping("/updateProperty")
    public int updateProperty(Property property){
        return propertyServic.updateProperty(property);
    }
    @ApiOperation(value = "查询所有物业信息",
            notes = "成功返回1")
    @RequestMapping("/getAllProperty")
    public List<Property> getAllProperty(Property property){
        return propertyServic.getAllProperty(property);
    }
    @ApiOperation(value = "查询物业信息",
            notes = "成功返回1")
    @RequestMapping("/getProperty")
    public Property getId(String PropertyId){
        Property property=new Property();
        property.setPropertyId(PropertyId);
        return propertyServic.getProperty(property);
    }
}
